//
//  BaseCollectionViewCell.m
//  FloatClouds
//
//  Created by 黄威 on 16/9/2.
//  Copyright © 2016年 黄威. All rights reserved.
//

#import "BaseCollectionViewCell.h"

@implementation BaseCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    
    if (self) {
        NSUserDefaults *nightIsOn = [NSUserDefaults standardUserDefaults];
        NSString *isOn = [nightIsOn objectForKey:@"night"];
        
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(ON)
                                                     name:@"NIGHTON"
                                                   object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(OFF)
                                                     name:@"NIGHTOFF"
                                                   object:nil];
        // self.navigationBar.translucent = NO;
        
        if ([isOn isEqualToString:@"0"]) {
            
            self.contentView.backgroundColor = [UIColor whiteColor];
            
            
            
        }else if([isOn isEqualToString:@"1"]){
            
            self.contentView.backgroundColor = [UIColor colorWithRed:93/255.0 green:92/255.0 blue:101/255.0 alpha:1];
            
        }
        
    }
    return self;
    
}
- (void)ON{
    
   self.contentView.backgroundColor =  [UIColor colorWithRed:93/255.0 green:92/255.0 blue:101/255.0 alpha:1];
    
    
}

- (void)OFF{
    //lanse
   self.contentView.backgroundColor =[UIColor whiteColor];
    
    
}

- (void)dealloc{
    
    
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NIGHTON" object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NIGHTOFF"object:nil];
    
    
}
@end
